<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	
<!--	按下事件onekeydown调用maskingKeyboad()函数屏蔽键盘的相关事件-->
	
	<body>

<script>

	function abso(){
		var num=form.num.value;
		if(isNaN(num)||num==""){
			alert('你输入的不是数字');
		}else{
			if(num>=0){
				alert(num+'的绝对值是'+num)
			}else{
				alert(num+'的绝对值是'+num*(-1));
			}
		}
	}






</script>

<form name="form" method="post" action="#">
<label>请输入数字：</label>
<input type="text" name="num" id="num" /><br />

<input type="button" name="sub" value="提交" onclick="abso()" /><p>


</form>


	</body>
</html>
